package com.nursing.controller.admin;

import com.nursing.model.Result;
import com.nursing.model.dto.CheckinCheckoutStatisticsDto;
import com.nursing.model.dto.ElderStatisticsDto;
import com.nursing.service.CheckinCheckoutService;
import com.nursing.service.ElderService;
import com.nursing.service.NurseService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/dashboard")
public class DashboardController {
    private final ElderService elderService;
    private final NurseService nurseService;

    private final CheckinCheckoutService checkinCheckoutService;

    public DashboardController(ElderService elderService, NurseService nurseService, CheckinCheckoutService checkinCheckoutService) {
        this.elderService = elderService;
        this.nurseService = nurseService;
        this.checkinCheckoutService = checkinCheckoutService;
    }

    @GetMapping("/getElderMonthlyCount")
    public Result<List<ElderStatisticsDto>> getMonthlyCount() {
        return Result.success(elderService.getMonthlyCount());
    }


    @GetMapping("/getCheckinCheckoutMonthlyCount")
    public Result<List<CheckinCheckoutStatisticsDto>> getCheckinCheckoutMonthlyCount() {
        return Result.success(checkinCheckoutService.getMonthlyCount());
    }


    @GetMapping("/getElderCount")
    public Result<Integer> getElderCount() {
        return Result.success(elderService.getElderCount());
    }

    @GetMapping("/getNurseCount")
    public Result<Integer> getNurseCount() {
        return Result.success(nurseService.getNurseCount());
    }
}
